-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OrderBook: Add market prices using Oracles #1674
Conversation
Compiling with |
2e32be4
to
6b59210
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I already have the base logic. Looking for your (fast) feedback before getting more into details @mustermeiszer @wischli
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments. Did not see anything I disagree with, great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to look at more depth tomorrrow, but what I can already say is that
- We need an additional extrinsic that is callable by
T::AdminOrigin
and allows to set aT::FeederId
Note: in case we need again the default inverse ratios in the future here is the reverted commit: 451a6c7 |
ae20e66
to
451a6c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks!
I made a couple of modifications to the internal FI structure:
|
9e32a92
to
e2e3091
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Part 1: Order book
pallets/order-book/src/lib.rs
Outdated
// update if the pair exists. | ||
let _old_min_order = TradingPair::<T>::get(&asset_in, &asset_out)?; | ||
TradingPair::<T>::insert(&asset_in, &asset_out, min_order); | ||
MarketFeederId::<T>::put(feeder_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An Event would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that FeederId
is just a value in a ValueStorage
, who would want to look for the event instead of reading the storage directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Events are a means of saying that the state changed, so yes indexers will most likely only see that change if there was an evenrt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, because the indexer can not also index "calls" done, right? Because in that case, just seeing that the call has been performed, they now the state has changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done anyways here: 4a0f52a
* minor renaming * fix: add same currency orderbook short cut * chore: enable test debugging for info * fix: FI integration tests * chore: enable debug logging * tests: fix after rebasing * chore: remove debug lines * chore: proof order of operators is not the issue * fix: swapped decrease amount * fix: ForeignIdToSwapId removal * tests: apply fixed ForeignIdToSwapId removal --------- Co-authored-by: lemunozm <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for all the sweat and effort you have put into this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks both for your awesome feedback and support 🙌🏻 |
Description
Improve
pallet-order-book
to swap currencies with a market price.Change list